package com.zzyl.nursing.util;

import cn.hutool.core.date.DatePattern;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;

public class TimeZoneUtils {
    public static LocalDateTime activeTime(String utcTimeStr, String pattern){
        LocalDateTime activeTime = LocalDateTime.parse(utcTimeStr, DateTimeFormatter.ofPattern(pattern));
        activeTime = activeTime.atZone(ZoneId.from(ZoneOffset.UTC))
                .withZoneSameInstant(ZoneId.of("Asia/Shanghai"))
                .toLocalDateTime();
        return activeTime;
    }
}
